import React,{useState} from 'react'
import { Link,Outlet} from 'react-router-dom'
import './gentogong.css'

export default function GenToGong(props) {
    const [classIndex,setClassIndex] = useState(0)
    function changeClass(e){
        setClassIndex(e.currentTarget.getAttribute("data-index"));
    }
  return (
    <div id='gentogong'>
        <div className='title'>
          {/* eslint-disable-next-line */}
          <Link to="staffline" className={"0"==classIndex?"active":""} onClick={changeClass} data-index="0"><span>安员工</span></Link>
          <Link to="departline" className={"1"===classIndex?"active":""} onClick={changeClass} data-index="1"><span>安部门</span></Link>
        </div>
        <div>
          <Outlet/>
        </div>
    </div>
  )
}
